import { lazy } from "react"

const HomeView = lazy(() => import('@/views/home/index'))
const IndexView = lazy(() => import('@/views/Index/index.tsx'))
// const IndexView = lazy(() => import('@/components/PreLoadingPage/index'))
const ArticleView = lazy(() => import('@/views/article/index.tsx'))
const LoginView = lazy(() => import('@/views/login/index.tsx'))
const ArticleDetailView = lazy(() => import('@/views/articleDetail/index.tsx'))
const PublishView = lazy(() => import('@/views/publish/index.tsx'))
const MessageView = lazy(() => import('@/views/message/index.tsx'))
const ProfileView = lazy(() => import('@/views/profile/index.tsx'))
const ProfileInfoView = lazy(() => import('@/views/profile_info/index.tsx'))
const AboutView = lazy(() => import('@/views/about/index.tsx'))
const loading = lazy(() => import('@/components/PreLoadingPage/index.tsx'))
const routes = [
  {
    path: "/",
    exact: true,
    requireHeader: false,
    component: IndexView,
  },
  {
    path: "/home",
    requireHeader: false,
    component: HomeView,
  },
  {
    path: "/article",
    exact: true,
    requireHeader: true,
    component: ArticleView,
    title: '文章列表'
  },
  {
    path: "/login",
    requireHeader: true,
    component: LoginView,
    title: '登录'
  },
  {
    requireHeader: true,
    path: "/article/detail/:id",
    name: 'article-detail',
    component: ArticleDetailView,
    title: '文章'
  },
  {
    path: "/publish",
    requireHeader: true,
    isLogin: true,
    component: PublishView,
    title: '文章发布'
  },
  {
    path: "/message",
    requireHeader: true,
    component: MessageView,
    title: '消息'
  },
  {
    path: "/profile",
    requireHeader: true,
    isLogin: true,
    exact: true,
    component: ProfileView,
    title: '个人主页'
  },
  {
    path: "/profile/info",
    requireHeader: true,
    exact: true,
    isLogin: true,
    component: ProfileInfoView,
    title: '个人资料'
  },
  {
    path: "/about",
    requireHeader: true,
    exact: true,
    isLogin: false,
    component: AboutView,
    title: '关于'
  },
  {
    path: "/loading",
    requireHeader: true,
    exact: true,
    isLogin: false,
    component: loading,
    title: '关于'
  },
]
export default routes